1. Field of the Invention
The present invention relates to a method for automatically generating computer code from a declarative language. It further relates to a computer system incorporating a code generator for automatically generating code.
2. Background
A declarative language is defined in the IEEE Standard Computer Dictionary as "a non-procedural language that permits the user to declare a set of facts and to express queries or problems that use these facts". The way in which user interfaces are described in the IBM ScreenView Program Product is an example of a declarative language.
The IBM ScreenView Program Product is a product for developing and running a consistent set of applications programs. The product comprises two parts: run time services to provide services to applications at run time and application development services which support programmers to develop various user interfaces for those applications.
In the ScreenView environment, the functional or business logic of an application is separated from the presentation or interface logic of an application. The presentation logic of an application is described by the application developer with the declarative language mentioned above. This guarantees independence of the functional parts of an application from the user interface technologies and allows an easy adaptation to new technologies and standards in the future.
The IBM ScreenView product is described in the manuals ScreenView Application Developer's Guide (IBM Form Number SC33-6452), ScreenView Application Developer's Reference (IBM Form Number SC33-6453) and ScreenView User's Guide (IBM Form Number SC33-6541) which are hereby incorporated by reference.
3. Prior Art
PCT Application WO-EP91/01642 discloses a method for specifying user interfaces in a declarative language which are independent of the type of interface used. With each user interface is associated a presentation front end which controls the input/output device associated with the interface specified.
The method of the PCT application PCT/EP91/01642 is very powerful in that it allows an end user to switch between interfaces to an applications program whilst the applications program is being used. However, use of the method is complicated by the fact that the developer of the applications program has to write the interface-independent code for the interface between the business logic and the presentation front end.
Since the declarative language defining the interface is abstract, exceptional programming skills are required to generate error-free code and the development of such code requires a large amount of time. In addition, one must ensure that the value of the variables requested or output by the interface correspond to the variables used in the business logic.
U.S. Pat. No. 4,742,467 describes an automated applications program development system and method which enables the automated development of COBOL programs. In this patent, the program developer utilizes graphics in order to paint a picture of the task to be carried out or the program to be developed. After the design phase has been completed, the program developers answers a series of question posed by the development system and a COBOL source program is then automatically generated, together with program documentation.
The code generator described in this patent does not use a declarative language from which the COBOL code is to be generated and gives no indication about how the code generating method might be extended to any declarative language. In addition, the teaching of this patent does not separate the user interface of the applications program from the business logic of the applications program. Thus, incorporating a new interface into the program will require redesign of the program, which is time consuming and expensive. In particular, the order in which the program requires inputs and outputs is determined not by the requirements of the interface but by the dictates of the program data flow.
A report entitled "Automated COBOL Code Generation for SNAP-I CAI Development and Maintenance Procedures" by M. A. Buhrmaster et al. of the Oak Ridge National Laboratory, report number ORNL/DSRD-8 describes research sponsored by the US Federal Government Department of Energy to develop a computer aided instruction (CAI) prototype for the U.S. Navy Management System Support Office as part of the Shipboard Non-tactical ADP Program (SNAP). The report discusses the techniques applied to store, access and manipulate data from a database management system (DBMS) to produce the necessary COBOL source code. The report does not, however, teach the use of a declarative language from which the COBOL code is generated nor does it provide for the use of multiple interface types.
A thesis presented by David Maurice King and Richard Montgomery Prevat III at the Naval Postgraduate School in Monterey, Calif. in December 1990 for the Master of Computer Science entitled "Rapid Production of Graphical User Interfaces" describes a tool, the Naval Postgraduate School Designer and Toolbox, which provides an automated development environment that enables design, implementation, modification and testing of customized graphical user interfaces. The tool can be used to create windows, panels and actuators for a graphical interface. A code generator can then be used to produce compatible C-language source code. The source code is compiled and linked to the applications program in order to produce a runnable program.
The teachings of this thesis are only applicable to the generation of source code which is used to produce graphical interfaces. The source code generator described produces not only the code required to ensure correct inputs and outputs but also the code required to generate the windows, panels and actuators. It cannot be used in order to generate interface-independent code. There is furthermore no indication about how the teachings of this patent may be applied to the use of a declarative language used to describe the interface to an applications program.
A product developed by Caseworks Incorporated called Case PM allows a developer to automatically generate Presentation Manager code. The code thereby developed is only suitable for use in programs using Presentation Manager as a direct management interface and there is no indication how the product might be used in interfaces other than graphic interfaces. Additionally the product does not allow a division between the business logic of the program and the interface code.
U.S. Pat. No. 4,956,773 and U.S. Pat. No. 4,831,525 both describe an information processing system in which schematic information relating to the data and logic processing of a program is input from a display screen using processing flow diagrams, internal data definition diagrams and interface data definition diagrams for each module of the program. The schematic information for each module is used to generate individual source code programs for each module which can then be edited and put together to form a complete source code program.
Both of these patents teach the use of methods in which the business logic of an applications program is automatically coded using a source code generator from the input schematic information. The teachings cannot be applied to the generation of source code for interfaces whose order depends on the variables to be input and the type of interface chosen for the business logic.